﻿var $C = $C || {};

void function($){
	/**
	 * 属性拷贝
	 * @param {} tar
	 * @param {} src
	 * @return {}
	 */
	$.extend = 	function(tar, src){
		src = src.prototype || src;
		for(var p in src){
			if(src.hasOwnProperty(p)){
				tar[p] = tar[p] || src[p];
			}
		}
		return tar;
	}

	$.extend($,{
		/**
		 * 获取元素
		 * @param {} id
		 * @return {}
		 */
		$: function(id){
			return typeof id == 'string' ? document.getElementById(id) : id;
		},
		$A : function(iterable){
			return Array.prototype.slice.call(iterable);
		},

		/**
		 * 添加 className
		 */
		addClass : function(el, className){
			el.className = el.className + ' ' + className;
		},

		/**
		 * 移除 className
		 */
		removeClass : function(el, className){
			el.className = el.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)'), '$1');
		}
	}
	);

}($C);

var tabState = 0;
var Adder = {

	changeTab : function(to){
		if(tabState != to){
			tabState = to;
			var tabs = [$C.$('lowerValueTab'),$C.$('notNetPropertyTab')],
				mods = [$C.$('lowerValuePart'),$C.$('notNetPropertyPart')]
				className = 'curTab';
			for(var i=0; i < tabs.length; ++i){
				$C.removeClass(tabs[i],className);
				mods[i].style.display = 'none';
			}
			$C.addClass(tabs[to],className);
			mods[to].style.display = '';
		}
	}

};